﻿// Release : code01, 2009/04/17                    
// Author  : Anytao, http://www.anytao.com
using System.Web.Mvc;
public class ActionInRoleAttribute : ActionNameSelectorAttribute {
    public ActionInRoleAttribute(string role) {
        this.role = role;
    }

    public override bool IsValidName(ControllerContext controllerContext, string actionName, System.Reflection.MethodInfo methodInfo) {
        if (controllerContext.HttpContext.User.IsInRole(role)) {
            return true;
        }
        else {
            return false;
        }
    }

    private string role;
}